<!DOCTYPE html>
<head>
  <meta charset="utf-8">
  <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><![endif]-->
  <title>登陆</title>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width">        
  <link rel="stylesheet" href="<?=base_url()?>css/templatemo_main.css">
  <script src="<?=base_url()?>js/jquery.min.js"></script>
   <script src="<?=base_url()?>js/bootstrap.min.js"></script>
   <script src="<?=base_url()?>js/Chart.min.js"></script>
   <script src="<?=base_url()?>js/templatemo_script.js"></script>
</head>
<body>
<div id="main-wrapper">
	<div class="navbar navbar-inverse" role="navigation">
		<div class="navbar-header">
			<div class="logo">
				<h1>集市宝仓库管理系统</h1>
			</div>
		</div>
	</div>
	<div class="template-page-wrapper">
		<form class="form-horizontal templatemo-signin-form" role="form"  id="form" onsubmit="return false;">
			<div class="form-group">
				<div class="col-md-12">
					<label for="username" class="col-sm-2 control-label">用户名</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" id="username" placeholder="请输入用户名">
					</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-12">
					<label for="password" class="col-sm-2 control-label">密码</label>
					<div class="col-sm-10">
						<input type="password" class="form-control" id="password" placeholder="请输入密码">
					</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-12">
					<div class="col-sm-offset-2 col-sm-10">
						<input type="submit" value="登陆" class="btn btn-default" id="submit_btn">
					</div>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
	$(document).ready(function() {
		$("#submit_btn").click(function() {
			var username = $("#username").val();
			var password = $("#password").val();
			$.ajax({
				url : '<?php echo site_url('index_admin/signin')?>',
				type : "post",
				async : true,
				data : {
					'username' : username,
					'password' : password
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						window.location.href='<?php echo site_url('order/index')?>';
					}else{
						alert(data.msg);
					}	
				}
			});
		});
		$(document).keydown(function(e) {
			if(e.keyCode == 13) {
				$("#submit_btn").trigger("click");
			}
		});
	}); 
</script>